const {
    comMysql
  } = require("../db/mysql")

const searchProd = (req,res)=>{
    let {username} = req.body
    let sql = `select * from prod where username = ?`
    let arr = [username]
    return comMysql(sql,arr)
}
const searchAdvice = (req,res)=>{
    let {username} = req.body
    let sql = `select * from advice where username = ?`
    let arr = [username]
    return comMysql(sql,arr)

}
const searchComment = (req,res)=>{
    let {username} = req.body
    let sql = `select comment.id,comment.content,comment.time,comment.goodNum,blogs.title,blogs.id as blogID from blogs LEFT JOIN comment on comment.blogid = blogs.id  where username = ?`
    let arr = [username]
    return comMysql(sql,arr)

}
// const search
  module.exports =  {
    searchProd,
    searchAdvice,
    searchComment
  }